

 /**  
 * @Description: TODO
 * @author: 
 * @since: 2016年10月25日 下午5:19:50
 * @Copyright: 2016 Painto All rights reserved.
 * @Version: 1.0   
 */
 
package com.guoxue.action.front;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.guoxue.domain.StageConfigVo;
import com.guoxue.service.IStageConfigService;
import com.guoxue.util.OSSUtil;

/**  
 * @Description: 闯关信息配置 
 * @author:   
 * @since: 2016年10月25日 下午5:19:50 
 */
@RequestMapping("Stage")
@Controller
public class StageAction extends BaseAction{
	@Resource
	private IStageConfigService stageService;
	@Resource
	private OSSUtil oss;
	@RequestMapping("/getStageConf")
	@ResponseBody
	public JSON getStage(HttpServletRequest req, HttpServletResponse resp){
		List<StageConfigVo> ls = stageService.getStageConfigList();
		if (ls.size()>0){
			for(StageConfigVo sc:ls){
				sc.setStagePicture(isEmpty(sc.getStagePicture())?null:oss.getUrl(bucket, sc.getStagePicture(),  new Date(new Date().getTime() + 3600 * 1000 * 12)));
			}
			return Message(SUCCESS, "加载闯关数据成功", ls);
		}
		return null;
	}

}

